Imports System.data.oledb
Imports System.data
Public Class loginform

    Private Data As List(Of Biometrics)
    Private prevTime As DateTime


    Sub New(ByVal data As List(Of Biometrics))
        InitializeComponent()
        Me.Data = data
    End Sub

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim logmgr As New LoginManager

        Dim emp As Employee
        emp = logmgr.login(TextBox1.Text, TextBox2.Text)
        If Not emp Is Nothing Then
            Dim infoMgr As New EmployeeInfoManager
            MainGlobalData.mEmployee = emp
            MainGlobalData.mEmployeeInfo = infoMgr.retrieveEmployeeInfoByEmployeeId(emp.id)
            frmMain.Show()
            Me.Hide()
        Else

            lblLoginFail.Show()
            prevTime = DateTime.Now
            LoginTimer.Enabled = True
        End If

        TextBox1.Text = ""
        TextBox2.Text = ""
    End Sub

    Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Hide()
        Dim frmverifier As New VerificationForm(Data)
        frmverifier.ShowDialog()

    End Sub

    

    
    Private Sub LoginTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoginTimer.Tick
        'get the time elapsed since prevtime
        Dim ts As TimeSpan = DateTime.Now.Subtract(prevTime)



        If ts.Seconds > 2 Then
            LoginTimer.Enabled = False
            lblLoginFail.Hide()
        End If
    End Sub
End Class